import request from '@/utils/request'

export function listSchedule(params) {
  return request({
    url: '/admin/v1/sys/schedule/list',
    method: 'get',
    params
  })
}
export function listScheduleLog(params) {
  return request({
    url: '/admin/v1/sys/scheduleLog/list',
    method: 'get',
    params
  })
}

export function getSchedule(id) {
  return request({
    url: '/admin/v1/sys/schedule/' + id,
    method: 'get'
  })
}
export function getScheduleLog(id) {
  return request({
    url: '/admin/v1/sys/scheduleLog/info/' + id,
    method: 'get'
  })
}

export function addSchedule(data) {
  return request({
    url: '/admin/v1/sys/schedule/save',
    method: 'post',
    data
  })
}

export function runSchedule(data) {
  return request({
    url: '/admin/v1/sys/schedule/run',
    method: 'post',
    data
  })
}
export function pauseSchedule(data) {
  return request({
    url: '/admin/v1/sys/schedule/pause',
    method: 'post',
    data
  })
}
export function resumeSchedule(data) {
  return request({
    url: '/admin/v1/sys/schedule/resume',
    method: 'post',
    data
  })
}

export function updateSchedule(data) {
  return request({
    url: '/admin/v1/sys/schedule/update',
    method: 'put',
    data
  })
}

export function delSchedule(data) {
  return request({
    url: '/admin/v1/sys/schedule/delete',
    method: 'delete',
    data
  })
}
